/*
 * @Author: Wangjun
 * @Date: 2021-05-15 22:43:19
 * @LastEditTime: 2024-04-01 14:04:28
 * @LastEditors: wangjun haodreams@163.com
 * @Description:
 * @FilePath: \golib\autoroute\controller\param.go
 * hnxr
 */
package controller

import (
	"gitee.com/haodreams/libs/kv"
	"github.com/gin-gonic/gin"
)

// NewParam 新参数
func NewParam(c *gin.Context) *kv.Param {
	m:= kv.NewParamByURL(c.Request.URL.RawQuery)
	if IsPost(c) {
		c.Request.ParseForm()
		for k, v := range c.Request.PostForm {
			m.Set(k, v[0])
		}
	}

	return m
}
